

// cookie
function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1) endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function getCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg) return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    return null;
}
function setCookie (name, value) {
    var exp = new Date();
    exp.setTime (exp.getTime()+3600000000);
    document.cookie = name + "=" + value + "; expires=" + exp.toGMTString();
}
// end

// --

// AJAX
$(function(){
	/*$("#loading").ajaxStart(function(){
	   $(this).css("left",$("body").width()-200);	
	   $(this).show();
	 }); 
	$("#loading").ajaxComplete(function(){
	   $(this).hide();
	 });
	*/ 
	$("#_loginBox").hide();
	 $.ajaxSetup({
		  cache: false,
		  type: "post"
	 });
	 
		
	 
});
function _ajax(url,para,fun){
	
	$.ajax({url:url,
			data:para,
			success:fun,
			error:function(data){
				//alert(data);
			}
	});
}
function debug(str){
	//alert(str);
}
// end

function getPos(oElement){
   var pos = {x:0,y:0};
   if( !oElement ) return pos;
   pos.x = oElement.offsetLeft;
   pos.y = oElement.offsetTop;
   var x = 0, y = 0;
   while( oElement.offsetParent ){
    //ç´¯å ä»è¯¥åç´ èµ·è³ç¶åç´ çoffsetLeftåoffsetTop
    x += oElement.offsetParent.offsetLeft;
    y += oElement.offsetParent.offsetTop;
    //
    if( oElement.offsetParent.tagName.toLowerCase() == "div" ){
     pos.x += x;
     pos.y += y;
     x = 0;
     y = 0;
    }
    oElement = oElement.offsetParent;
   }
   return pos;
}

function obj_onkeydown(obj){
	//alert(obj.id);
	$("#"+obj.id+"OK").html("");
}

